/**
 * 通用混合
 * */
export default {
	data() {
		return {
			// key值为对应表操作的前缀
			tabarr: [
				{ key: "add", name: "新增" },
				{ key: "preArrival", name: "预到" },
				{ key: "arrived", name: "已到" },
				{ key: "overdue", name: "过期未到" },
				{ key: "ordered", name: "预约" },
				{ key: "revision", name: "改约" },
			],
			// list
			addlist: [],
			preArrivallist: [],
			arrivedlist: [],
			overduelist: [],
			orderedlist: [],
			revisionlist: [],
			// total
			totallist: { add: '', order_arrive: '', arrive: '', unarrive: '', oprate_arrive: '', change_arrive: '' },
			loading: false,
			list: [],
			total: 0,
			searchData: {},
			columns: [],
			pageOpts: [10, 15, 20, 30, 50], // 分页每页数量
		};
	},
	mounted() {
		this.initial();
	},
	methods: {
		addaskData() {
			this.loading = true;
			let params1 = JSON.parse(JSON.stringify(this.params1))
			params1.city_id = this.city_id1
			params1.channel_id = params1.channel_id.length>0?params1.channel_id.join(','):''
			this.patientindexaddlist(params1).then((res) => {
				// this.list = res.list;
				let list = []
				for (let item of res.list) {
					if (+item.patient_data_type !== 0) item.realname = ''
					list.push(item)
				}
				this.list = list
				this.total = res.total;
				this.totallist.add = res.total;
				this.loading = false;
			});
		},
		// 预到患者列表
		preArrivalaskData() {
			this.loading = true;
			let params2 = JSON.parse(JSON.stringify(this.params2))
			params2.city_id = this.city_id2
			params2.channel_id = params2.channel_id.length>0?params2.channel_id.join(','):''
			this.patientindexorderarrivelist(params2).then((res) => {
				this.list = res.list;
				this.total = res.total;
				this.totallist.order_arrive = res.total;
				this.loading = false;
			});
		},
		// 已到患者列表
		arrivedaskData() {
			this.loading = true;
			let params3 = JSON.parse(JSON.stringify(this.params3))
			params3.city_id = this.city_id3
			params3.channel_id = params3.channel_id.length>0?params3.channel_id.join(','):''
			this.patientindexarrivelist(params3).then((res) => {
				// this.list = res.list;
				let list = []
				for (let item of res.list) {
					if (+item.patient_data_type !== 0) item.realname = ''
					list.push(item)
				}
				this.list = list
				this.total = res.total;
				this.totallist.arrive = res.total;
				this.loading = false;
			});
		},
		// 过期未到患者列表
		overdueaskData() {
			this.loading = true;
			let params4 = JSON.parse(JSON.stringify(this.params4))
			params4.city_id = this.city_id4
			params4.channel_id = params4.channel_id.length>0?params4.channel_id.join(','):''
			this.patientindexunarrivelist(params4).then((res) => {
				this.list = res.list;
				this.total = res.total;
				this.totallist.unarrive = res.total;
				this.loading = false;
			});
		},
		orderedaskData() {
			this.loading = true;
			let params5 = JSON.parse(JSON.stringify(this.params5))
			// console.log(this, 4444444)
			params5.city_id = this.city_id5
			params5.channel_id = params5.channel_id.length>0?params5.channel_id.join(','):''
			this.patientindexoperatearrivelist(params5).then((res) => {
				this.list = res.list;
				this.total = res.total;
				this.totallist.oprate_arrive = res.total;
				this.loading = false;
			});
		},
		revisionaskData() {
			this.loading = true;
			let params6 = JSON.parse(JSON.stringify(this.params6))
			params6.city_id = this.city_id6
			params6.channel_id = params6.channel_id.length>0?params6.channel_id.join(','):''
			this.patientindexchangearrivelist(params6).then((res) => {
				this.list = res.list;
				this.total = res.total;
				this.totallist.change_arrive = res.total;
				this.loading = false;
			});
		},
		condition(res) {
			this.addsearchData.project.forEach(item => {
				if (item.id === 6) {
					if (res.condition.status_list) item.childList = res.condition.status_list
				} else if (item.id === 7) {
					if (res.condition.member_list) item.childList = res.condition.member_list
				} else if (item.id === 8) {
					if (res.condition.diseases) item.childList = res.condition.diseases
				} else if (item.id === 9) {
					if (res.condition.source_channel) {
						item.childList = res.condition.source_channel
					}
				} else if (item.id === 10) {
					if (res.condition.tags_list) item.childList = res.condition.tags_list
				} else if (item.id === 12) {
					if (res.condition.talk_way) item.childList = res.condition.talk_way
				} else if (item.id === 20) {
					if (res.condition.talk_way) item.childList = res.condition.body_parts
				}
			})
			this.preArrivalsearchData.project.forEach(item => {
				if (item.id === 6) {
					if (res.condition.status_list) item.childList = res.condition.status_list
				} else if (item.id === 7) {
					if (res.condition.member_list) item.childList = res.condition.member_list
				} else if (item.id === 8) {
					if (res.condition.diseases) item.childList = res.condition.diseases
				} else if (item.id === 9) {
					if (res.condition.source_channel) {
						item.childList = res.condition.source_channel
					}
				} else if (item.id === 10) {
					if (res.condition.tags_list) item.childList = res.condition.tags_list
				} else if (item.id === 12) {
					if (res.condition.talk_way) item.childList = res.condition.talk_way
				} else if (item.id === 20) {
					if (res.condition.talk_way) item.childList = res.condition.body_parts
				}
			})
			this.arrivedsearchData.project.forEach(item => {
				if (item.id === 6) {
					if (res.condition.status_list) item.childList = res.condition.status_list
				} else if (item.id === 7) {
					if (res.condition.member_list) item.childList = res.condition.member_list
				} else if (item.id === 8) {
					if (res.condition.diseases) item.childList = res.condition.diseases
				} else if (item.id === 9) {
					if (res.condition.source_channel) {
						item.childList = res.condition.source_channel
					}
				} else if (item.id === 10) {
					if (res.condition.tags_list) item.childList = res.condition.tags_list
				} else if (item.id === 12) {
					if (res.condition.talk_way) item.childList = res.condition.talk_way
				} else if (item.id === 20) {
					if (res.condition.talk_way) item.childList = res.condition.body_parts
				}
			})
			this.overduesearchData.project.forEach(item => {
				if (item.id === 6) {
					if (res.condition.status_list) item.childList = res.condition.status_list
				} else if (item.id === 7) {
					if (res.condition.member_list) item.childList = res.condition.member_list
				} else if (item.id === 8) {
					if (res.condition.diseases) item.childList = res.condition.diseases
				} else if (item.id === 9) {
					if (res.condition.source_channel) {
						item.childList = res.condition.source_channel
					}
				} else if (item.id === 10) {
					if (res.condition.tags_list) item.childList = res.condition.tags_list
				} else if (item.id === 12) {
					if (res.condition.talk_way) item.childList = res.condition.talk_way
				} else if (item.id === 20) {
					if (res.condition.talk_way) item.childList = res.condition.body_parts
				}
			})
			this.orderedsearchData.project.forEach(item => {
				if (item.id === 6) {
					if (res.condition.status_list) item.childList = res.condition.status_list
				} else if (item.id === 7) {
					if (res.condition.member_list) item.childList = res.condition.member_list
				} else if (item.id === 8) {
					if (res.condition.diseases) item.childList = res.condition.diseases
				} else if (item.id === 9) {
					if (res.condition.source_channel) {
						item.childList = res.condition.source_channel
					}
				} else if (item.id === 10) {
					if (res.condition.tags_list) item.childList = res.condition.tags_list
				} else if (item.id === 12) {
					if (res.condition.talk_way) item.childList = res.condition.talk_way
				} else if (item.id === 20) {
					if (res.condition.talk_way) item.childList = res.condition.body_parts
				}
			})
			this.revisionsearchData.project.forEach(item => {
				if (item.id === 6) {
					if (res.condition.status_list) item.childList = res.condition.status_list
				} else if (item.id === 7) {
					if (res.condition.member_list) item.childList = res.condition.member_list
				} else if (item.id === 8) {
					if (res.condition.diseases) item.childList = res.condition.diseases
				} else if (item.id === 9) {
					if (res.condition.source_channel) {
						item.childList = res.condition.source_channel
					}
				} else if (item.id === 10) {
					if (res.condition.tags_list) item.childList = res.condition.tags_list
				} else if (item.id === 12) {
					if (res.condition.talk_way) item.childList = res.condition.talk_way
				} else if (item.id === 20) {
					if (res.condition.talk_way) item.childList = res.condition.body_parts
				}
			})
		},
	},
};
